define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	var Message = require("$UI/system/components/justep/common/common");
	
	var Model = function(){
		this.callParent();
		this.type = 'OK';
		this.title = '提示';
		this.inputValue = '北京';
		this.text = '啦啦啦不能为空';
		this.width = '';
	};
	Model.prototype.showMsg = function(event) {
//		Message.message("aler", "通过组件的方式创建MessageDialog");
		this.comp("messageDialg").show({
			title : this.title,
			message : this.text,
		});
	};
	Model.prototype.loginClick = function(event) {
        var msg = "登录成功";
        var loginData = {};
        var userData = null;

        loginData.username = this.comp("loginname").val();
        loginData.password = this.comp("password").val();
        if (this.comp("loginname").val() === "" || this.comp("password").val() === "") {
                msg = "请输入用户名或者密码！";

        } else {
                
                baas.sendRequest({
                        "url" : "/takeout",
                        "action" : "queryUser",
                        "params" : loginData,
                        "success" : function(ret) {
                                this.comp("userData").loadData(ret,false);
                                
                                
                        }

                });

                if (userData === null) {
                        msg = ("用户名或者密码错误！");

                } else {
                        this.comp('backDialog').open({
                                data : {
                                        userData : 'userData',

                                }
                        });

                }
        }
        alert(msg);

};
	return Model;
});